1. Field of the Invention
The present invention relates to software development and, more particularly, to identifying unused memory in a software application.
2. Description of the Related Art
Reducing the amount of memory needed by a software application, or computer program, during execution remains a challenge for software developers. Generally, memory is viewed as a finite resource. Memory used by one program becomes unavailable for use by others. A program that uses less memory also is more likely to fit within physical memory. This results in the ability to store more programs within the same system in physical memory. Further, when a program is stored entirely in physical memory, slower external storage mechanisms, such as swapping data between physical memory and a hard disk, need not be utilized. During development, memory conservation strategies are followed in an effort to minimize memory usage and improve software performance. The identification and elimination of wasted memory during the execution of a program remains a concern throughout the development process.
Memory typically is managed in blocks, with a memory block referring to an amount of memory that can be allocated for use by a program. Memory blocks are allocated to programs for use during execution, are tracked, and ultimately are reclaimed for future use by the same program or another program. When a memory block cannot be freed by a running program, the result is a memory leak. Usually, a memory leak occurs because the reference pointer to the memory block has been lost for one reason or another. Repeated generation of leaked memory space can cause a program to run out of memory or stop functioning altogether.
A variety of software development tools are commercially available for locating memory leaks in programs. Memory management tools, for example, can provide functions such as memory corruption detection and memory leak detection. While these functions provide useful information, to date, memory leaks have been analyzed on the memory block level. That is, conventional memory management tools determine whether an entire block of memory is being used or referenced by a given program. Intra-memory block usage by a program typically goes unnoticed. In other words, conventional memory management tools are unable to determine the amount or portion of an allocated memory block that is actually used by a program during execution.
Unused portions of allocated memory blocks are caused by a variety of different circumstances including, but not limited to, obsolete fields remaining in a data structure or using an overly general data structure for a task. These circumstances needlessly increase the heap size of a program. As conventional memory management tools do not provide such information, developers usually are unaware of whether a program efficiently uses portions of allocated memory blocks.